<template>
  <div class="list-top">
    <img :src="detail.coverImgUrl" class="bg-img" />

    <div class="top-nav">
      <div class="left">
        <svg class="icon" @click="back" aria-hidden="true">
          <use xlink:href="#icon-zuojiantou" />
        </svg>
        <div class="top-title">歌单</div>
      </div>
      <div class="right">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-sousuo" />
        </svg>
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-gengduo" />
        </svg>
      </div>
    </div>

    <div class="content">
      <div class="content-left">
        <img :src="detail.coverImgUrl" />
        <div class="count">
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-bofang" />
          </svg>
          {{playCount(detail.playCount)}}
        </div>
      </div>
      <div class="content-right">
        <h4>{{detail.name}}</h4>
        <div class="author">
          <img :src="detail.creator.avatarUrl" alt class="header" />

          <span class="name">{{detail.creator.nickname}}</span>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-arrow-right-copy-copy-copy-copy-copy" />
          </svg>
        </div>
        <div class="writing">{{detail.description}}</div>
      </div>
    </div>

    <div class="iconList">
      <div class="iconItem">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-comment" />
        </svg>
        <span>{{playCount(detail.commentCount)}}</span>
      </div>
      <div class="iconItem">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-a-fenxiang" />
        </svg>
        <span>{{playCount(detail.shareCount)}}</span>
      </div>
      <div class="iconItem">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-tianjia" />
        </svg>
        <span>{{playCount(detail.subscribedCount)}}</span>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ["detail"],

  methods: {
    playCount(count) {
      let res = 0;
      if (count >= 100000000) {
        res = count / 100000000;
        res = res.toFixed(2) + "亿";
      } else if (count >= 10000) {
        res = count / 10000;
        res = res.toFixed(2) + "万";
      } else {
        res = count;
      }
      return res;
    },
    back() {
      this.$router.go(-1);
    }
  }
};
</script>
<style scoped lang="less">
.list-top {
  margin: 0 0 2rem 0;
  width: 7.5rem;
  height: 5rem;
  .bg-img {
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: -1;
    filter: blur(50px);
  }
  .top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 1.2rem;
    font-size: 0.24rem;
    .left {
      display: flex;
      align-items: center; //水平对齐
      .top-title {
        font-size: 0.3rem;
        margin: 0.2rem 0.2rem;
        color: white;
      }
      .icon {
        width: 0.5rem;
        height: 0.5rem;
        margin: 0.2rem 0.2rem;
      }
    }
    .right {
      .icon {
        width: 0.5rem;
        height: 0.5rem;
        fill: white;
        margin: 0.2rem 0.2rem;
      }
    }
  }
  .content {
    display: flex;
    margin: 0.4rem 0;
    .content-left {
      position: relative;
      width: 3rem;
      img {
        width: 2.5rem;
        height: 2.5rem;
        margin: 0rem 0.2rem;
        border-radius: 0.2rem;
      }
      .count {
        position: absolute;
        top: 0.1rem;
        right: 0.4rem;
        display: flex;
        align-items: center;
        font-size: 0.2rem;
        color: #ccc;
        .icon {
          fill: #ccc;
        }
      }
    }
    .content-right {
      width: 4rem;
      h4 {
        color: white;
        font-weight: 500;
        font-size: 0.28rem;
      }
      .author {
        display: flex;
        align-items: center;
        margin: 0.25rem 0;
        img {
          width: 0.6rem;
          border-radius: 50%;
          margin-right: 0.3rem;
        }
        .name {
          font-size: 0.16rem;
          color: #ccc;
          margin-right: 0.4rem;
        }
      }
      .writing {
        font-size: 0.24rem;
        color: #aaa;
        display: flex;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }
    }
  }
  .iconList {
    display: flex;
    justify-content: space-around;
    .iconItem {
      display: flex;
      flex-direction: column;
      align-items: center;
      .icon {
        width: 0.5rem;
        height: 0.5rem;
        fill: white;
      }
      span {
        padding-top: 0.1rem;
        font-size: 0.26rem;
        color: #ccc;
      }
    }
  }
}
</style>